| Fully Qualified Name: | CodeIgniter\Images\Image |
| Extends: | File |
Encapsulation of an Image file
| Name | Description | Defined By |
|---|---|---|
| __construct() | Run our SplFileInfo constructor with an optional verification that the path is really a file. | File |
| copy() | Makes a copy of itself to the new location. If no filename is provided it will use the existing filename. | Image |
| getDestination() | Returns the destination path for the move operation where overwriting is not expected. | File |
| getMimeType() | Retrieve the media type of the file. SHOULD not use information from the $_FILES array, but should use other methods to more accurately determine the type of file, like finfo, or mime_content_type(). | File |
| getProperties() | Get image properties | Image |
| getRandomName() | Generates a random names based on a simple hash and the time, with the correct file extension attached. | File |
| getSize() | Retrieve the file size. | File |
| getSizeByUnit() | Retrieve the file size by unit. | File |
| guessExtension() | Attempts to determine the file extension based on the trusted getType() method. If the mime type is unknown, will return null. | File |
| move() | Moves a file to a new location. | File |
Run our SplFileInfo constructor with an optional verification that the path is really a file.
| Parameter Name | Type | Description |
|---|---|---|
| $path | string | |
| $checkFile | bool |
Returns:
Makes a copy of itself to the new location. If no filename is provided it will use the existing filename.
| Parameter Name | Type | Description |
|---|---|---|
| $targetPath | string | The |
| $targetName | string|null | The |
| $perms | int | File |
Returns: bool
Returns the destination path for the move operation where overwriting is not expected.
First, it checks whether the delimiter is present in the filename, if it is, then it checks whether the last element is an integer as there may be cases that the delimiter may be present in the filename. For the all other cases, it appends an integer starting from zero before the file's extension.
| Parameter Name | Type | Description |
|---|---|---|
| $destination | string | |
| $delimiter | string | |
| $i | int |
Returns: string
Retrieve the media type of the file. SHOULD not use information from the $_FILES array, but should use other methods to more accurately determine the type of file, like finfo, or mime_content_type().
Returns: string|null The media type we determined it to be.
Get image properties
A helper function that gets info about the file
| Parameter Name | Type | Description |
|---|---|---|
| $return | bool |
Returns: mixed
Generates a random names based on a simple hash and the time, with the correct file extension attached.
Returns: string
Retrieve the file size.
Implementations SHOULD return the value stored in the "size" key of the file in the $_FILES array if available, as PHP calculates this based on the actual size transmitted.
Returns: int The file size in bytes
Retrieve the file size by unit.
| Parameter Name | Type | Description |
|---|---|---|
| $unit | string |
Returns: int|string
Attempts to determine the file extension based on the trusted getType() method. If the mime type is unknown, will return null.
Returns: string|null
Moves a file to a new location.
| Parameter Name | Type | Description |
|---|---|---|
| $targetPath | string | |
| $name | string|null | |
| $overwrite | bool |
Returns: \CodeIgniter\Files\File